﻿using ORM.Exception;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ORM.Parser.Design
{
    public class StatementFactory
    {
        public static BaseStatement CreateStatement(string SQLText)
        {
            BaseStatement returnstatement = null;
            if (SQLText.Trim().StartsWith("insert"))
            {
                returnstatement = new InsertStatement();
            }
            else if (SQLText.Trim().StartsWith("delete"))
            {
                returnstatement =  new DeleteStatement();
            }
            else if (SQLText.Trim().StartsWith("update"))
            {
                returnstatement =  new UpdateStatement();
            }
            else
            {
                throw new StatementNoRecognizeException();
            }
            return returnstatement;
        }
    }
}
